I have a variable myref set to: set myref {$expect_out(buffer)} What is the quickest way to get the $expect_out(buffer) into myval? set myval [HOWTOEVAL $myref] ...

Assume we have an expression like (x > 5) in C language. Is there any guarantee given by the language / standard that the expression will be evaluated to 0 when it's false and to 1 when it's true? ...

I thought racket does inner reduction always for evaluation but I found out e.g. "if" (and cond?!) is lazy evaluation in racket...why is this needed? Is it impossible to realize an if-statement via inner reduction? I can not figure out where lazy evaluation is better than inner and vice versa?...

I try to parse html page using XPath with xidel. The page have a table with multiple rows and columns I need to get values from each row from columns 2 and 5 (IP and port) and store them in csv-like file. Here is my script #!/bin/bash for (( i...

I am trying to calculate this input: evaluate({mul,{plus,{num,2},{num,3}},{num,4}}). and get this as an answer: 20 But I cant get it working, here is my code: evaluate(List) -> [Res] = lists:foldl(fun evaluate/2, [], tuple_to_list(List)), Res. evaluate({num,X},Stack) -> [X|Stack]; evaluate(plus,[N1,N2|Stack])->[N1+N2|Stack]; evaluate(mul,[N1,N2|Stack])->[N1*N2|Stack]; evaluate([{Optr, Num1, Num2}],Stack) -> evaluate(Num1,Stack),evaluate(Num2,Stack),evaluate(Optr,Stack). Can you point out my mistakes...

Is there a way to limit the amount of time an evaluation is allowed to run? Or limit the amount of memory that MatLab is allowed to take up so it doesn't freeze my laptop?

Say we have a data.table myDT <- data.table(id = c("a", "a", "b", "b", "c"), value = 1:5) setkey(myDT, id) I'd like to create a function fun <- function(id) { ... } such that if foo <- rep("b", 6) then fun(foo) # I want this to return 3 4 Basically, I...

Is it possible in R to assign custom functions to mathematical operators (eg. *, +) or interpret the formulae supplied with as.formula() as a directive to evaluate? Specifically, I would like * to be interpretted as intersect(), and + as c(), so R would evaluate the expression (a * (b...

I've been working on a program that stores a series of scheduled events (home made ServiceRequest objects) in an xml file (f), and when I want to work with them I call a readData() method (see below) which loads the ServiceRequest's into serviceQueue(an ArrayList<ServiceRequest>) and I tag a null object...

I have a question about programing in general, Could someone explain me why : Evaluation of parameters from right to left is more efficient than left to right Unspecified evaluation is more optimized than the other 2 Thanks, Nathan...

This question already has an answer here: Why does division result in zero instead of a decimal? 6 answers I'm trying to find a ratio between a song's current position and its total playing time. long pTime = player.getCurrentBufferedTimeMcsec(); long pos = player.getCurrentPosition(); return (int)(pos/pTime * 1000000l); The return...

I have downloaded the latest update on text classification template. I created a new app and imported stopwords.json and emails.json by specifying app id $ pio import --appid <appID> --input data/stopwords.json $ pio import --appid <appID> --input data/emails.json Then I changed engine.json and given my app name in it. {...

I am new to haskell and I would like you to give me your suggestion about the following haskell expression evaluation. f xs = foldr (\x n->n+1) 0 xs function f [1, 4] Evaluation (\x n->n+1) 1 (foldr (\x n->n+1) 0 [4]) = (foldr (\x n->n+1) 0 [4]) + 1...

I want to write a small script to tell me if the bass level is OK or not from user input. I am just learning user input, and this is what I have so far: def crisp(): bass = input("Enter bass level on a scale of 1 to 5>>") print...

I want to write a function that applies one of two different statistical methods to its input. In the process, I noticed some behavior of different functions that I do not understand. The function I want to write should have the following properties: it should have a vector as a...

I would like to expand a data.frame to include a new column & give this column a dynamically assigned name passed within a function. Here is a simplified example: passMyName <-function(df, newColTitle) { df2 <-data.frame(df, newColTitle = rep(NA, nrow(df))) return(df2) } randomDF <-data.frame(a=1:3, b=4:6, c=7:9) passMyName(randomDF, myCustomColTitle) This will add...