This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static class EqualRange extends SuMethod2 { | |
{ params = new FunctionSpec(array("value", "block"), Boolean.FALSE); } | |
@Override | |
public Object eval2(Object self, Object a, Object b) { | |
Range r = ((SuContainer) self).equalRange(a, b); | |
return SuContainer.of(r.left, r.right); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Params("value, block=false") | |
public static Object EqualRange(Object self, Object a, Object b) { | |
Range r = ((SuContainer) self).equalRange(a, b); | |
return SuContainer.of(r.left, r.right); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
for (int i = 0; i < array.length; ++i) { | |
if (i > 0) | |
sb.append(","); | |
sb.append(fn(array[i])); | |
} | |
return sb.toString(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if (list.isEmpty()) | |
return ""; | |
for (Object x : list) | |
sb.append(fn(x)).append(","); | |
return sb.deleteCharAt(sb.length() - 1).toString(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if (list.isEmpty()) | |
return ""; | |
for (Object x : list) | |
sb.append(",").append(fn(x)); | |
return sb.substring(1); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class CommaStringBuilder implements Appendable { | |
private final StringBuilder sb; | |
private boolean first = true; | |
public CommaStringBuilder() { | |
sb = new StringBuilder(); | |
} | |
public CommaStringBuilder(String s) { | |
sb = new StringBuilder(s); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CommaStringBuilder csb = new CommaStringBuilder("("); | |
for (Object x : list) | |
csb.add(fn(x)); | |
return csb.append(")").toString(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
getLibsNames(libs) | |
{ | |
list = Object() | |
for (i = 0; i < libs.Size(); ++i) | |
{ | |
lib = libs[i] | |
li = i.Pad(2) | |
for x in QueryList(lib $ " where group = -1", "name") | |
{ | |
list.Add(x.Tr("_").Lower() $ "=" $ x $ ":" $ li) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
max_matches: 30 | |
GetMatches(prefix) | |
{ | |
list = Suneido.LibLocate.list | |
prefix = prefix.Tr("_").Lower() | |
from = list.LowerBound(prefix) | |
to = Min(from + .max_matches, list.LowerBound(prefix.RightTrim() $ "~")) | |
matches = list[from .. to] | |
matches.Map!({ it.AfterFirst("=") }) | |
matches.Sort!().Unique!() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Package float10 implements decimal floating point numbers | |
// using uint64 to hold the coefficient. | |
package float10 | |
import "strconv" | |
import "errors" | |
import "strings" | |
import "math" | |
// value is -1^sign * coef * 10^exp |
OlderNewer